<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no" />
    <link rel="stylesheet" href="__CSS__/common.css">
    <link rel="stylesheet" href="__CSS__/advice.css">
    <title>投诉建议</title>
</head>
<body>
<form method="post" action="{:url('user/advice')}">
    <p class="title">您有任何意见或建议，我们都乐意接受哦～</p>
    <textarea class="opinion-area" name="content" rows="20" cols="40" autofocus="autofocus" placeholder="请将您的想法告诉我们"></textarea>
    <div class="msg">
        <input type="text" name="contact" placeholder="请留下您的联系方式：邮箱/手机号">
    </div>
    <button class="btn" onclick="return advice()">提交</button>
</form>
</body>
<script src="__JS__/jquery.min.js"></script>
<script src="__JS__/layer.js"></script>
<script type="text/javascript">
    function advice() {
        var advice=$(".opinion-area").val().trim();
        var phone=$('.msg>input').val().trim();
        if(advice==""){layer.msg("意见反馈不能为空", {time: 1500})}
        else if(phone==""){layer.msg("联系方式不能为空", {time: 1500})}
        else {
            $.ajax({
                type:'post',
                url:$("form").attr('action'),
                data:$("form").serialize(),
                success:function (data){
                    if(data.code==1){
                        layer.msg(data.msg,{time:1500});
                        //alert(data.data);
                        location.href=data.data
                    }else{
                        layer.msg(data.msg,{time:1500});
                    }
                },
                error:function () {

                }

            })
        }
        return false;
    }

</script>
</html>